#include <iostream>

class SimpleCat
{
 public:
  SimpleCat(int age, int weight);
  ~SimpleCat()
  {
  }
  int GetAge()
  {
    return itsAge;
  }
  int GetWeight()
  {
    return itsWeight;
  }

  int itsAge;
  int itsWeight;
};
SimpleCat::SimpleCat(int age, int weight)
{
  itsAge = age;
  itsWeight = weight;
}

class SimpleDog
{
 public:
  SimpleDog(char *age, int weight);
  ~SimpleDog()
  {
  }
  char* GetName()
  {
    return itsName;
  }
  int GetWeight()
  {
    return itsWeight;
  }

  char *itsName;
  int itsWeight;
};

SimpleDog::SimpleDog(char *age, int weight)
{
  itsName = age;
  itsWeight = weight;
}

SimpleCat &TheFunction(int age);

int main()
{
  SimpleCat &rCat = TheFunction(2);
  std::cout << "rCat  is " << rCat.GetAge() << " years old!" << std::endl;
  SimpleDog dog("wang", 20);
  rCat.itsAge = 20;
  dog.itsName = "wanggg";
  std::cout << "rCat  is " << rCat.GetAge() << " years old!" << std::endl;
  std::cout << "dog  name: " << dog.itsName << std::endl;
  return 0;
}

// This is a wrong idea
SimpleCat &TheFunction(int age)
{
  SimpleCat Frisky(age, 9);
  return Frisky;
}
